<!-- 调度记录 -->
<template>
  <BaseContainer>
    <aplid-base-crud ref="crud" class="w-100" v-bind="{...baseConfig,...$attrs}" @operateFormate="handleOperate"> 
      <template #handleDialog="{row}">
        <AplidForm ref="formRef" v-bind="HandleFormConfig" :modelValue="row"  @submit="onSubmit"> </AplidForm>
      </template>
      <template v-slot:menuColumn="{ row }">
        <el-button
					v-if="!row.handleImgs"
					type="primary"
          v-auth="'view_pbDispatch_edit'"
					link
					@click="handleOperate('handle',row,'处理')"
				>
					处理
				</el-button>
      </template>
      <template #detailDialog="{row}">
        <DetailPart :nowRowData="row"></DetailPart>
      </template>
    </aplid-base-crud>
  </BaseContainer>
</template>

<script setup>
import {baseConfig,detailConfig,otherDetailConfig} from './config'
import apiMod from '@/apiMod/index'
import DetailPage from '@/views/aplid/DetailPage/index.vue'
import DetailPart from './detail.vue'
let crud = ref()
const handleRefresh = (query, visible = false) => {
  nextTick(() => {
    crud.value.refreshChange(query)
  })
}
const HandleFormConfig = {
  inline: false,
	showBtn: true,
	labelPosition: 'top',
	labelWidth: '120px',
	column: [
    {
      label:"处理人",
      prop:"handleUserName",
      rules:[
        {message:"请填写处理人",required:true}
      ],
      span:12
    },
    {
      label:"处理时间",
      prop:"handleTime",
      type:'datetime',
      format:"YYYY年MM月DD HH:mm:ss",
      valueFormat:"YYYY-MM-DD HH:mm:ss",
      rules:[
        {message:"请填写处理时间",required:true}
      ],
      span:12
    },
    {
      label:"处理图片",
      prop:"handleImgs",
      type:"upload",
      rules:[
        {message:"请上传图片",required:true}
      ],
      limit:4,
      span:12
    }
  ]
}
const onSubmit = (form,done) =>{
  apiMod.view_pbDispatch_edit(form).then(res=>{
    done()
    handleRefresh()
  })
}
const handleOperate = (type, row, title) => {
  console.log('操作')
  nextTick(() => {
    crud.value.handleOperate(type, row, title)
  })
}
</script>

<style lang="scss" scoped></style>
